home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBGRX100.ARJ / TEST.C < prev    next >
Text File  |  1992-04-10  |  2KB  |  66 lines

  1. /** 
  2.  ** TEST.C 
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24.  
  25. #include "test.h"
  26. #include <time.h>
  27.  
  28. TESTFUNC(test1)
  29. {
  30.     long x,y;
  31.     int  ii,results[16];
  32.  
  33.     x = time(NULL);
  34.     y = 0L;
  35.     while(!kbhit()) {
  36.         GrClearScreen(GrWhite());
  37.         GrClearScreen(GrBlack());
  38.         y++;
  39.     }
  40.     x = time(NULL) - x;
  41.     sprintf(exit_message,"%ld screen writes in %ld seconds, transfer rate = %ld Kbytes/sec\n",
  42.         y,
  43.         x,
  44.         (x == 0L) ?
  45.         0L :
  46.         ((long)GrSizeX() * (long)GrSizeY() * y) /
  47.             (x * 1000L) /
  48.             ((GrNumColors() < 256) ? 8 : 1)
  49.     );
  50.     getkey();
  51.     drawing(0,0,GrSizeX(),GrSizeY(),GrWhite(),GrBlack());
  52.     getkey();
  53.     GrClearScreen(GrBlack());
  54.     for(ii = 0; ii < 16; ii++) {
  55.         GrPlot(100+5*ii,100,ii);
  56.         results[ii] = GrPixel(100+5*ii,100);
  57.     }
  58.     getkey();
  59.     GrSetMode(GR_default_text);
  60.     for(ii = 0; ii < 16; ii++) {
  61.         printf("written pixel: 0x%02x, read back 0x%02x\n",ii,results[ii]);
  62.     }
  63.     getkey();
  64. }
  65.  
  66.